Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi target support #653

Merged
merged 38 commits into from
Oct 10, 2023
Merged

Multi target support #653

merged 38 commits into from
Oct 10, 2023

Conversation

adnull
Copy link
Contributor

@adnull adnull commented May 7, 2023

This is multi-target support implementation of the mongodb_exporter. This version can be used with prometheus to allow scraping multiple hosts metrics by running just single instance of the exporter.

The code contains minimal changes to implement this feature and doesn't conflict with the main branch.
Multiple targets can be specified in the mongodb.uri option as comma separated list of server URIs
Also, a new option was added - mongodb.connect-timeout-ms which sets default server connection timeout.
Usage notes are located in the readme file in my fork https://github.com/adnull/mongodb_exporter_mt


  • Tests passed.
  • Fix conflicts with target branch.

@adnull adnull requested a review from a team as a code owner May 7, 2023 17:29
@adnull adnull requested review from tshcherban and IuriiMr and removed request for a team May 7, 2023 17:29
@adnull adnull mentioned this pull request May 22, 2023
adnull and others added 12 commits May 30, 2023 15:32
percona#639)

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.47.3 to 1.52.2.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](golangci/golangci-lint@v1.47.3...v1.52.2)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
percona#665)

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.52.2 to 1.53.2.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](golangci/golangci-lint@v1.52.2...v1.53.2)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Remove prometheus/client_golang replace

* Apply formater

* Downgrade client_golang to previous version

* Upgrade exporter-toolkit to v0.10.0
@adnull
Copy link
Contributor Author

adnull commented Aug 4, 2023

@JiriCtvrtka Hi! Seems like there are problems with the test-cluster. I've checked all tests on my local machine and they are failing like this only if test-cluster didn't set up properly.
For example, this error:

    testutils.go:135:
        	Error Trace:	/Users/user/projects/mongodb_exporter/internal/tu/testutils.go:135
        	Error:      	Received unexpected error:
        	            	server selection error: context deadline exceeded, current topology: { Type: Single, Servers: [{ Addr: 127.0.0.1:17001, Type: Unknown, Last error: dial tcp 127.0.0.1:17001: connect: connection refused }, ] }

means that node mongo-1-1 is down.
Probably it is not enough disk space to run cluster. Or it needs a little bit more time to come up before running tests.

@JiriCtvrtka
Copy link
Contributor

@adnull Hi. Yes I am on it. I also noticed some minor problems in exporter (not in your PR). I will merge this once since it will be fixed. Thank you for your PR and efford.

Copy link
Member

@BupycHuk BupycHuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments.
Once PR with test fixes is merged we will check that tests are not failed and merge this PR. As far as I see there are no backward incompatible changes.

exporter/exporter.go Outdated Show resolved Hide resolved
exporter/server.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@BupycHuk
Copy link
Member

@adnull please fix the linter
@JiriCtvrtka PTAL

@adnull
Copy link
Contributor Author

adnull commented Oct 10, 2023

@adnull please fix the linter

Sure, forgot to format. done.

@BupycHuk
Copy link
Member

@adnull, linters are still complaining. Please address them.

@adnull
Copy link
Contributor Author

adnull commented Oct 10, 2023

@adnull, linters are still complaining. Please address them.

Sure, i am looking into it and can't get why they fail with the errors like tagalign and nlreturn on the code which is no different from the main code while the same actions in my own repository finish successfully.

@BupycHuk BupycHuk merged commit e02fe4f into percona:main Oct 10, 2023
5 of 6 checks passed
@BupycHuk
Copy link
Member

@adnull Seems like your changes wasn't related to linter complains. They existed before, but because you changed those lines linter started complaining. So I merged as is.

@adnull
Copy link
Contributor Author

adnull commented Oct 11, 2023

Oh, they almost broke my mind :) Seems like linters list should be adjusted...

@Swoods3
Copy link

Swoods3 commented Jan 16, 2024

Splitting mongodb_uri with commas and within a double quote for example: "mongodb:connection_string" is no longer acceptable. Is there a way to make the config file backwards compatible as it is for versions 0.0.4 to 3.0.1?

Current target is a single cluster multi port as defined by Atlas to monitor and has been working for the last year ENCLOSED in double quotes and has comma separated the 3 target cluster ports as the teams use to connect to the atlas and has been working, but no longer works with version 3.1.0. Here is an example that used to work:

mongodb_uri: "mongodb://user:[email protected]:20000,nameN.mongodb.net:20001,nameN.mongodb.net:20002/dbname-qa?authSource=admin&replicaSet=name&ssl=true&retryWrites=true&w=majority"

@adnull
Copy link
Contributor Author

adnull commented Jan 16, 2024

Splitting mongodb_uri with commas and within a double quote for example: "mongodb:connection_string" is no longer acceptable. Is there a way to make the config file backwards compatible as it is for versions 0.0.4 to 3.0.1?

I've got the idea and will take a look shortly

@Swoods3
Copy link

Swoods3 commented Jan 16, 2024 via email

@adnull
Copy link
Contributor Author

adnull commented Jan 17, 2024

@Swoods3 i've created a pull-request (#780) regarding the problem you've described. But while it is being waited to be approved and included to a release you can use manually compiled code from the branch or try using my docker image with this feature included: https://hub.docker.com/r/adnull/mongodb_exporter

@Swoods3
Copy link

Swoods3 commented Jan 17, 2024

@adnull Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants